package jee.boot.entity.activiti;

import jee.boot.common.annotation.Column;
import jee.boot.common.annotation.Table;
import jee.boot.common.basic.Page;
import jee.boot.entity.system.Filter;

/**
 * 运行时流程执行实例表
 * 核心，我的代办任务查询表
 */
@Table(name = "act_ru_execution")
public class ActExecution extends ActDataEntity<ActExecution> {
    private static final long serialVersionUID = 1L;
    /**
     * 乐观锁
     */
    @Column(name = "REV_")
    private String rev;
    /**
     * 流程实例ID
     */
    @Column(name = "PROC_INST_ID_")
    private String procInst;
    /**
     * 业务主键ID
     */
    @Column(name = "BUSINESS_KEY_")
    private String businessKey;
    /**
     * 父节点
     */
    @Column(name = "PARENT_ID_")
    private ActExecution parent;
    /**
     * 流程定义ID
     */
    @Column(name = "PROC_DEF_ID_", data = {"procDef.id", "procDef.name", "procDef.key", "procDef.category", "procDef.", "procDef.version", "procDef.resourceName", "procDef.description"})
    private ActProcDef procDef;
    /**
     *
     */
    @Column(name = "SUPER_EXEC_")
    private String superExec;
    /**
     * 节点实例ID即
     * ACT_HI_ACTINST中ID
     */
    @Column(name = "ACT_ID_", extraConditions = {"a.ID_=act.EXECUTION_ID_"}, key = "ACT_ID_", data = {"act.id", "act.actName", "act.actId", "act.actType", "act.assignee"})
    private ActActInst act;
    /**
     * 激活状态,是否存活
     */
    @Column(name = "IS_ACTIVE_")
    private String isActive;
    /**
     * 并发状态 是否为并行(true/false）
     */
    @Column(name = "IS_CONCURRENT_")
    private String isConcurrent;
    /**
     *
     */
    @Column(name = "IS_SCOPE_")
    private String isScope;
    /**
     *
     */
    @Column(name = "IS_EVENT_SCOPE_")
    private String isEventScope;
    /**
     * 挂起状态   1激活 2挂起
     */
    @Column(name = "SUSPENSION_STATE_")
    private String suspensionState;
    /**
     * 缓存结束状态_
     */
    @Column(name = "CACHED_ENT_STATE_")
    private String cachedEntState;
    @Column(name = "ID_", key = "EXECUTION_ID_", data = {"variable.id", "variable.json"})
    private VActRuVariable variable;

    //where	variable.JSON_ -> '$.applicant'= 'superadmin'
    public ActExecution() {
    }

    public ActExecution(String id) {
        super(id);
    }

    public String getRev() {
        return rev;
    }

    public void setRev(String rev) {
        this.rev = rev;
    }

    public String getProcInst() {
        return procInst;
    }

    public void setProcInst(String procInst) {
        this.procInst = procInst;
    }

    public String getBusinessKey() {
        return businessKey;
    }

    public void setBusinessKey(String businessKey) {
        this.businessKey = businessKey;
    }

    public ActExecution getParent() {
        return parent;
    }

    public void setParent(ActExecution parent) {
        this.parent = parent;
    }

    public ActProcDef getProcDef() {
        return procDef;
    }

    public void setProcDef(ActProcDef procDef) {
        this.procDef = procDef;
    }

    public String getSuperExec() {
        return superExec;
    }

    public void setSuperExec(String superExec) {
        this.superExec = superExec;
    }

    public ActActInst getAct() {
        return act;
    }

    public void setAct(ActActInst act) {
        this.act = act;
    }

    public String getIsActive() {
        return isActive;
    }

    public void setIsActive(String isActive) {
        this.isActive = isActive;
    }

    public String getIsConcurrent() {
        return isConcurrent;
    }

    public void setIsConcurrent(String isConcurrent) {
        this.isConcurrent = isConcurrent;
    }

    public String getIsScope() {
        return isScope;
    }

    public void setIsScope(String isScope) {
        this.isScope = isScope;
    }

    public String getIsEventScope() {
        return isEventScope;
    }

    public void setIsEventScope(String isEventScope) {
        this.isEventScope = isEventScope;
    }

    public String getSuspensionState() {
        return suspensionState;
    }

    public void setSuspensionState(String suspensionState) {
        this.suspensionState = suspensionState;
    }

    public String getCachedEntState() {
        return cachedEntState;
    }

    public void setCachedEntState(String cachedEntState) {
        this.cachedEntState = cachedEntState;
    }

    public VActRuVariable getVariable() {
        return variable;
    }

    public void setVariable(VActRuVariable variable) {
        this.variable = variable;
    }

    public static void main(String[] args) {
        ActExecution actExecution = new ActExecution();
        actExecution.setPage(new Page<>());
        actExecution.getPage().setOrderBy("variable.json");
        actExecution.addFilter(new Filter("variable.json","->","\"$.title\" = \"测试审批UniteFlow-1\""));
        actExecution.addFilter(new Filter("procDef.name","=","123"));
        actExecution.addFilter(new Filter("rev","=","123"));
        actExecution.addFilter(new Filter("abcSed","=","123"));
        actExecution.addFilter(new Filter("variable","=","123"));
        System.out.println(actExecution.getFindListSql()+" where "+actExecution.getWhere()+" "+actExecution.getOrderBySql());
    }
}
